import java.util.Arrays;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner scn = new Scanner(System.in);
    int n = scn.nextInt();
    int[] a = new int[n];
    for(int i = 0; i < n; ++i) {
      a[i] = scn.nextInt();
    }
    Arrays.sort(a);
    System.out.printf("%d ", a[n-1]);
    if((n % 2) == 0) {
      int i = n / 2; // 0 1 2 3, n = 4, i = 2
      long m = a[i-1] + a[i];
      if((m % 2) == 0) {
        System.out.printf("%d ", m / 2);
      }else {
        System.out.printf("%d.5 ", m / 2);
      }
    }else {
      System.out.printf("%d ", a[n / 2]);
    }
    System.out.println(a[0]);
  }
}
/*
3
-1 2 4

4 2 -1

4
1 2 3 4

4
1 2 2 4
 */